# -*- conding:UTF-8 -*-

'''
@ Project: day1_zy
@ File: serializers.py
@ Author: 罗婷
@ Date：2022/7/15 21:26

'''
from rest_framework import serializers

from users.models import User


class User_Serializer(serializers.ModelSerializer):
    # 序列化输出时选项字段展示文字
    usex_name = serializers.SerializerMethodField()
    def get_usex_name(self, obj):
        return obj.get_usex_dispaly()

    class Mate:
        model = User
        fields = '__all__'
        read_only_fields = ['id']




